#ifndef CONSOLE_HPP
#define CONSOLE_HPP

#include "GlobalDefines.hpp"
//#include "Interface/textField.h"
#include "ConsoleAccessable.hpp"
#include "string.h"
#include <map>
#include <fstream>
#include "State/App.hpp"

class Console
{
public:
  void Register(ConsoleAccessable *consolable);

  void Log(std::string lines);

  bool Visible();

  bool Visible(bool tf);

  bool KeysDown(sf::Event::KeyEvent key);

  bool KeysUp(sf::Event::KeyEvent key);

  void Draw ();

  void Update(double dTime);

  void Resize();

  static Console* Instance();
private:
  Console();      // private constructor for instance

//    TextField output;

//    TextField input;

  bool consoleVisible;

  std::vector<ConsoleAccessable*> items;

  std::map<int, std::deque<std::string> > keybinds;

  static Console *instance;

  void ExecuteCurrentCommand();

  std::string ExecuteCommand(std::deque<std::string> tokens);

  std::string BindCommand(std::deque<std::string> tokens);

  std::deque<std::string> Tokenize (std::string input);

  void RecalcSizes();

  void StoreKeybinds();
};
#endif
